//hook的方式只能用于toolkit 只能用于函数组件
import "./App.css"

import { useSelector, useDispatch } from "react-redux"


import { changenumThunk} from "./store/tollkitIndex"

function App() {
  // useSelector((state)=>{console.log(state)})
  //取出state
  let num = useSelector((state) => { return state.Numreducer.num })
  let dispatch = useDispatch()
  return <>
    <button onClick={() => {
      dispatch({
        type: "numSlicce/addNum"
      })
    }}>修改state的num</button>

    <button onClick={() => {
      dispatch(changenumThunk(9090))
    }}>异步的修改</button>
    <div className="App"> hook的方式连接到全局状态管理 --{num}</div>
  </>
}

export default App